if (!window.navigator.standlaone) {
    document.addEventListener("DOMContentLoaded", adjustHeight, false);
}
function adjustHeight() {
    var html = document.documentElement;
    var size = window.innerHeight;
    
    html.style.height = (size + size) + "px";
    window.setTimeout(function() {
        if (window.pageYOffset == 0) {
            window.scrollTo(0, 0);
        }
        html.style.height = window.innerHeight + "px";
    }, 0);
}

switch (window.orientation) {
    /* Normal orientation, home button on the bottom */
    case 0:
        document.body.className = "portrait";
        break;
    
    /* Rotated 90 degrees to the left */
    case 90:
        document.body.className = "landscape";
        break;
    
    /* Upside Down */
    case 180:
        document.body.className = "portrait";
        break;
    
    /* Rotated 90 degrees to the right */
    case -90:
        document.body.className ="portrait";
        break;
}

if (!window.navigator.standalone) {
    document.addEventListener("DOMContentLoaded", adjustHeight, true);
    window.addEventListener("orientationchange", adjustHeight, true);
} else { /* Target only standalone mode */ document.addEventListener("click", clickHandler, true); }